package com.itheima.pattern.t17_observer.demo2;

import java.util.Observable;

/**
 * 小偷类，被观察者
 */
public class Thief extends Observable {

    private String name;

    public Thief(String name) {
        this.name = name;
    }

    public void steal() {
        System.out.println("小偷：我偷东西了，有没有人来抓我！！！");
        super.setChanged();
        super.notifyObservers();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
